/* ´ÙÀ½Àº È­ÀÏÀÇ Áß°£À¸·Î ÀÔ·Â Æ÷ÀÎÅÍÀÇ À§Ä¡¸¦ À̵¿½ÃÅ°°í ±×°÷¿¡¼­ºÎÅÍ È­ÀÏÀÇ ³»¿ëÀ» Ãâ·ÂÇϱâ À§ÇØ seekg()¸¦ »ç¿ëÇÑ´Ù. È­ÀÏÀÇ À̸§°ú Àб⸦ ½ÃÀÛÇÒ À§Ä¡´Â ¸í·É¾î ¶óÀο¡ ¸í½ÃµÇ¾î¾ß ÇÑ´Ù. */ // seekg()¸¦ º¸¿©ÁØ´Ù. #include #include #include int main(int argc, char *argv[]) { char ch; if (argc != 3) { cout << "Usage: LOCATE \n"; return 1; } ifstream in(argv[1]); if (!in) { cout << "Cannot open input file.\n"; return 1; } in.seekg(atoi(argv[2]), ios::beg); while (!in.eof()) { in.get(ch); cout << ch; } in.close(); return 0; }